# $Id: PKGBUILD 172301 2012-12-02 09:47:22Z andyrtr $
# Maintainer: Andreas Radke <andyrtr@archlinux.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: SleepyDog

pkgname=glew
pkgver=1.9.0
pkgrel=2
pkgdesc="The OpenGL Extension Wrangler Library"
arch=('i686' 'x86_64')
url="http://glew.sourceforge.net"
license=('BSD' 'MIT' 'GPL')
depends=('libxmu' 'libxi' 'glu')
source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tgz
        glxew_export_fix.diff)
sha1sums=('9291f5c5afefd482c7f3e91ffb3cd4716c6c9ffe'
          'f389645a1400aebdadce596fec970cfe0be6c15b')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  
  # fix compilation for some 3rd party apps; FS#32835
  patch -Np1 -i ${srcdir}/glxew_export_fix.diff
  
  sed -i 's|lib64|lib|' config/Makefile.linux
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make GLEW_DEST="${pkgdir}/usr" install.all
  install -D -m644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  rm "${pkgdir}"/usr/lib/{libGLEW,libGLEWmx}.a
  chmod 0755 "${pkgdir}"/usr/lib/libGLEW*.so.${pkgver}
}
